select top 10 * from tblUser_Log Order By UpdateDate dESC

select UserID, UserAccount, DisplayName, TeamID, Min(UpdateDate) from tblUser_Log
Where TeamID IN (1,2)
Group by UserID, UserAccount, DisplayName, TeamID
Having Count(userID) > 1

select UserID, UserAccount, TeamID, Min(UpdateDate) from tblUser_Log
Where UserID IN (Select UserID from tblUser_Log Where TeamID = 1)
And UserID IN (Select UserID from tblUser_Log Where TeamID = 2)
Group by UserID, UserAccount, TeamID

select UserID, UserAccount, Displayname, T.TeamName, UL.Description UserLevel, UpdateDate from tblUser_Log U
INNER JOIN tblUserLevelInfo UL ON UL.UserLevelID = U.UserLevelId
INNER JOIN tblTeam T ON U.TeamID = T.TeamID
Where U.UserID IN (Select UserID from tblUser_Log Where TeamID = 1)
And U.UserID IN (Select UserID from tblUser_Log Where TeamID = 2)
Order By U.UserID, U.UpdateDate

select top 10 * from tblCaseProfileIndex Where ProcessedBy = 36

Declare @ProcessedOn as datetime =  '2014-05-20 18:40:38.810'

select Top 1 TeamID from tblUser_Log Where UpdateDate < @ProcessedOn and UserID = 36 Order By UpdateDate DESC

select UL.UserID, * from tblUser U 
LEFT OUTER JOIN tblUser_Log UL ON U.UserID = UL.UserId
Where UL.UserID IS NULL

select * from tblUser_Log Where UserID = 36



